home *** CD-ROM | disk | FTP | other *** search
/ EuroCD 3 / EuroCD 3.iso / Programming / vbcc / machines / amigappc / include / stdlib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-06-24  |  1.6 KB  |  80 lines

  1. /* stdlib.h - vbcc PowerPC */
  2.  
  3. #ifndef __STDLIB_H
  4. #define __STDLIB_H 1
  5.  
  6. #include <stddef.h>
  7. #include <limits.h>
  8.  
  9. #ifndef EXIT_FAILURE
  10. #define EXIT_FAILURE 20
  11. #endif
  12. #ifndef EXIT_SUCCESS
  13. #define EXIT_SUCCESS 0
  14. #endif
  15.  
  16. #define RAND_MAX 32768
  17.  
  18. void exit(int);
  19. void *malloc(size_t);
  20. void *calloc(size_t,size_t);
  21. void *realloc(void *,size_t);
  22. void free(void *);
  23. int system(const char *);
  24. int rand(void);
  25. void srand(unsigned int);
  26. double atof(const char *);
  27. int atoi(const char *);
  28. long atol(const char *);
  29. double strtod(const char *,char **);
  30. long strtol(const char *,char **,int);
  31. unsigned long strtoul(const char *,char **,int);
  32. void abort(void);
  33. int atexit(void (*)(void));
  34. char *getenv(const char *);
  35. void *bsearch(const void *,const void *,size_t,size_t,int (*)(const void *,const void *));
  36. void qsort(void *,size_t,size_t,int (*)(const void *,const void *));
  37.  
  38. /* PowerPC inline functions */
  39. int abs(__reg("r3") int) =
  40.                 "\tcmpwi\t3,0\n"
  41.                 "\tbge\t$+8\n"
  42.                 "\tneg\t3,3";
  43. long labs(__reg("r3") long) =
  44.                 "\tcmpwi\t3,0\n"
  45.                 "\tbge\t$+8\n"
  46.                 "\tneg\t3,3";
  47.  
  48. typedef struct {
  49.     int quot,rem;
  50. } div_t;
  51.  
  52. typedef struct {
  53.     long quot,rem;
  54. } ldiv_t;
  55.  
  56. div_t div(int,int);
  57. ldiv_t ldiv(long,long);
  58.  
  59. union _mheader {
  60.     struct{
  61.         union _mheader *ptr;
  62.         size_t size;
  63.     } s;
  64.     long align;
  65. };
  66.  
  67. extern size_t _nalloc;
  68.  
  69. #define atof(s) strtod((s),(char **)NULL)
  70. #define atoi(s) (int)strtol((s),(char **)NULL,10)
  71. #define atol(s) strtol((s),(char **)NULL,10)
  72.  
  73. struct __exitfuncs{
  74.     struct __exitfuncs *next;
  75.     void (*func)(void);
  76. };
  77.  
  78. #endif
  79.  
  80.